package com.huaxin.device.dto.enums.typehandler;

import com.huaxin.device.dto.enums.AlarmLevel;
import com.huaxin.hxenum.base.BaseCodeEnumTypeHandler;
import org.apache.ibatis.type.JdbcType;
import org.apache.ibatis.type.MappedTypes;

import java.sql.PreparedStatement;
import java.sql.SQLException;

@MappedTypes(AlarmLevel.class)
public class AlarmLevelHandler extends BaseCodeEnumTypeHandler<AlarmLevel, Integer> {

    public AlarmLevelHandler() {
        super(AlarmLevel.class);
    }

    @Override
    public void setNonNullParameter(PreparedStatement ps, int i, AlarmLevel parameter, JdbcType jdbcType) throws SQLException {
        ps.setInt(i, parameter.getCode());
    }
}